﻿@model EmptoolWebApp.Models.CompanyListViewModel
@{
    ViewBag.Title = "List company";
    Layout = "~/Views/Shared/_LayoutList.cshtml";
}

@*<div class="panel panel-default">
    <div class="panel-body">
        <button type="button" class="btn btn-primary">
            <span class="glyphicon glyphicon-plus"></span>
            Add company
        </button>
    </div>
</div>*@

@*<p data-spy="affix">
    <button class="btn btn-primary">Add company</button>
</p>*@


<div class="container-fluid">
    <div class="row">

    </div>
</div>

@*<ol class="breadcrumb">
    <li><a href="#">Home</a></li>
    <li><a href="#">Library</a></li>
    <li class="active">Data</li>
</ol>*@

<table class="table table-striped table-hover">
    <caption>Company List</caption>
    <thead>
        <tr>
            <th class="col-md-1">#</th>
            <th class="col-md-2">Company name</th>
            <th class="col-md-2">Relationship</th>
            <th class="col-md-1">Action(s)</th>
            <th class="col-md-6"></th>
        </tr>
    </thead>
    <tbody>
        @if ((Model != null) && (Model.CompanyEntityList != null) && (Model.CompanyEntityList.Count > 0))
        {
            int record_number = 1;
            foreach (EmptoolWebApp.Entities.CompanyEntity company in Model.CompanyEntityList)
            {
                <tr>
                    <td>@record_number</td>
                    <td>
                        @*<div class="btn-group btn-link">
                            <button type="button" class="btn btn-default btn-link">@company.CompanyName</button>
                            <button type="button" class="btn btn-default btn-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                <span class="caret"></span>
                                <span class="sr-only">Toggle Dropdown</span>
                            </button>
                            <ul class="dropdown-menu">
                                <li><a href="#">Action</a></li>
                                <li><a href="#">Another action</a></li>
                                <li><a href="#">Something else here</a></li>
                                <li role="separator" class="divider"></li>
                                <li><a href="#">Separated link</a></li>
                            </ul>
                        </div>*@
                        @Html.ActionLink(company.CompanyName, "Details", "Company", new { id = company.PartitionKey }, null)
                    </td>
                    <td>@CompanyHelper.GetRelationship(company.PartitionKey, User.Identity.Name)</td>
                    <td>
                        @*<button class="btn btn-link action-link">
                            <span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
                        </button>
                        &nbsp;
                        <button class="btn btn-link action-link">
                            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                        </button>*@

                        <a href="@Url.Action("Edit", "Company", new { id = company.PartitionKey })" class="btn btn-link btn-sm" title="Update company information">
                            <span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
                        </a>

                        <a href="@Url.Action("Delete", "Company", new { id = company.PartitionKey })" class="btn btn-link btn-sm" title="Delete company">
                            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                        </a>

                        <a href="@Url.Action("List", "Employee", new { id = company.PartitionKey })" class="btn btn-link btn-sm" title="Delete company">
                            Employee List <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> 
                        </a>
                        
                    </td>
                    <td></td>
                </tr>
                record_number++;
            }
        }
        else
        {
            <tr>
                <td colspan="5" class="col-md-12">No records found.</td>
            </tr>
        }

    </tbody>
</table>

@section actions {
    
    <div class="well" data-spy="affix">

        <div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title">Actions</h3>
            </div>
            <div class="panel-body">
                The following actions are available.
            </div>
            <ul class="list-group">
                @*<li class="list-group-item">
                    <a href="#">Inbox <span class="badge pull-right">42</span></a>
                </li>*@

                @*<li class="list-group-item">
                    <button class="btn btn-primary" type="button">
                        Messages <span class="badge">4</span>
                    </button>
                </li>*@

                @*<li class="list-group-item">
                    <a href="@Url.Action("List", "Company")" class="btn btn-link btn-sm">
                        <span class="glyphicon glyphicon-list" aria-hidden="true"></span>
                        View company list
                    </a>
                </li>*@
                <li class="list-group-item">
                    <a href="@Url.Action("Create", "Company")" class="btn btn-link btn-sm">
                        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                        Add company
                    </a>
                </li>
            </ul>

            @*<div class="panel-footer text-center">
                <nav>
                    <ul class="pagination">
                        <li>
                            <a href="#" aria-label="Previous">
                                <span aria-hidden="true">&laquo;</span>
                            </a>
                        </li>
                        <li><a href="#">1</a></li>

                        <li>
                            <a href="#" aria-label="Next">
                                <span aria-hidden="true">&raquo;</span>
                            </a>
                        </li>
                    </ul>
                </nav>
            </div>*@

        </div>

        <div class="panel panel-info">
            <div class="panel-heading">
                <h3 class="panel-title">Statistics <span class="caret pull-right" style="cursor:pointer;" data-toggle="collapse" data-target=".statistics-content"></span></h3>
            </div>
            @*<div class="panel-body statistics-content collapse in">
                Some statistics about data in this table.
            </div>*@
            <ul class="list-group statistics-content collapse in">
                <li class="list-group-item">
                    Number of records <span class="badge pull-right label-primary">42</span>
                </li>

                @*<li class="list-group-item">
                    <a href="@Url.Action("List", "Company")" class="btn btn-link btn-sm">
                        <span class="glyphicon glyphicon-list" aria-hidden="true"></span>
                        View company list
                    </a>
                </li>
                <li class="list-group-item">
                    <a href="@Url.Action("Create", "Company")" class="btn btn-link btn-sm">
                        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                        Add company
                    </a>
                </li>*@
            </ul>
            
        </div>

    </div>
}